// 滑动进度条
var totalVolume = document.querySelector(".rdy");
var volume = document.querySelector(".cur");
var setVolumeBtn = document.querySelector(".f-tdn");

var buTime = 0;

// 设置长摁鼠标事件
setVolumeBtn.onmousedown = function(event) {
    var event = event || window.event;
    var leftVal = event.clientX - this.offsetLeft;
    // var thar = this;

    document.onmousemove = function(e) {
        var e = e || window.e;
        buTime = e.clientX - leftVal;

        // 判断 buTime 满足的条件
        if (buTime < 0) {
            buTime = 0;
        } else if (buTime > scroll.offsetWidth - volume.offsetWidth) {
            buTime = scroll.offsetWidth - volume.offsetWidth;
        } else if (buTime > 466) {
            buTime = 466;
        }
        // 改变 volume totalVolume 的宽度
        totalVolume.style.width = buTime + "px";
        volume.style.width = buTime + "px";
        // thar.style.left = buTime + "px";
        volume.style.backgroundColor = "red";
    }

    document.onmouseup = function() {
        document.onmousemove = null;
    }
}

// 设置点击播放